package com.hrc.springbootdemo.aop.jdk;

import java.lang.reflect.Proxy;

public class DynamicProxyExample {
    public static void main(String[] args) {
        Service realService = new RealService();
        Service proxyInstance = (Service) Proxy.newProxyInstance(
                realService.getClass().getClassLoader(),
                new Class<?>[]{Service.class},
                new ServiceInvocationHandler(realService));
        proxyInstance.performService();
    }
}